package com.frogs.ucenter.v1.request;

import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.util.ApplicablePlatformEnum;
import com.frogs.system.util.ExpandCodeEnum;
import com.frogs.system.util.OpenPlatformEnum;
import com.frogs.system.util.UserTypeEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;

/**
 * 任务列表请求参数类
 *
 * @author lijian
 * @version 2014年10月20日 - 上午11:02:00
 */
public class PointTaskInfoListRequest extends Request {

	private Integer taskId;
	
	private Integer userId;
	
	private Integer levelId;
	
	private String expandCode ;
    
	private Integer applicablePlatformId;
	
	private Integer openPlatformId;
	
	private Integer pageNo;
	
	private Integer pageSize;
	
	private String actionType;
	
	public PointTaskInfoListRequest() {
	}
	
	@Override
	public void parse(HttpServletRequest request) {
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		
		this.taskId = requestInfo.getIntParameter(ApiUrlParamEnum.taskId.getParamName(), 0);
		this.userId = requestInfo.getIntParameter(ApiUrlParamEnum.userId.getParamName(), 0);
		this.levelId = requestInfo.getIntParameter(ApiUrlParamEnum.level.getParamName(), UserTypeEnum.ALL.getType());
		this.expandCode = requestInfo.getParameter(ApiUrlParamEnum.expandCode.getParamName(), ExpandCodeEnum.MALL.getId());
		this.applicablePlatformId = requestInfo.getIntParameter(ApiUrlParamEnum.applicablePlatformId.getParamName(), ApplicablePlatformEnum.WEB.getId());
		this.openPlatformId = requestInfo.getIntParameter(ApiUrlParamEnum.openPlatformId.getParamName(), OpenPlatformEnum.WECHAT_HDC.getId());
		this.pageNo = requestInfo.getIntParameter(ApiUrlParamEnum.pageNo.getParamName(), 1);
		this.pageSize = requestInfo.getIntParameter(ApiUrlParamEnum.pageSize.getParamName(), 10);
		this.actionType = requestInfo.getParameter(ApiUrlParamEnum.actionType.getParamName(), "");
		if ( userId < 1 ) {
			throw new RequestIllegalException("error userId: " + userId);
		}
	}

	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	public Integer getTaskId() {
		return taskId;
	}

	public void setTaskId(Integer taskId) {
		this.taskId = taskId;
	}

	public Integer getPageNo() {
		return pageNo;
	}

	public void setPageNo(Integer pageNo) {
		this.pageNo = pageNo;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public Integer getLevelId() {
		return levelId;
	}

	public void setLevelId(Integer levelId) {
		this.levelId = levelId;
	}

	public String getExpandCode() {
		return expandCode;
	}

	public void setExpandCode(String expandCode) {
		this.expandCode = expandCode;
	}

	public Integer getApplicablePlatformId() {
		return applicablePlatformId;
	}

	public void setApplicablePlatformId(Integer applicablePlatformId) {
		this.applicablePlatformId = applicablePlatformId;
	}

	public Integer getOpenPlatformId() {
		return openPlatformId;
	}

	public void setOpenPlatformId(Integer openPlatformId) {
		this.openPlatformId = openPlatformId;
	}

	public String getActionType() {
		return actionType;
	}

	public void setActionType(String actionType) {
		this.actionType = actionType;
	}

}
